#2178: Make Release commandlet build-tool independent - #2302
Conversation
Coverage Report for CI Build 33897948638Coverage increased (+0.03%) to 73.907%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions20 previously-covered lines in 3 files lost coverage.
Coverage Stats💛 - Coveralls |
maybeec
left a comment
There was a problem hiding this comment.
Thanks for picking this up 👍 — and thanks especially for not stopping at the literal ask. Turning the detection loop from last match wins into first match wins (BuildCommandlet#findBuildCommandlet) quietly fixes two real bugs that were sitting in BuildCommandlet:
- In a yarn project (
package.json+yarn.lock) the old loop had nobreak, so afterYarnmatched it kept going andNpm— last inBUILD_TOOLS— always took over.Yarn.findBuildDescriptorwas effectively unreachable. - Worse, in a polyglot repo (
pom.xmlandpackage.json) the old code rannpmbut resolved the defaults fromMVN_BUILD_OPTS, i.e. it executednpm clean install. Hoisting theargs.isEmpty()block out of the loop fixes that too.
Also good: the parent == null guard in isTopLevelProject — the old projectPath.getParent().resolve("pom.xml") would have thrown a raw NPE when releasing from a filesystem root.
No blockers. The instanceof BuildTool gate is the right shape, CliException is the correct exception type here (expected, user-facing abort), no public signature was broken, and the tests stay inside target. A few things I'd like to see before merge:
Should-fix
ReleaseCommandlet:45-48— the error message collapses "no build descriptor at all" and "build tool found but it cannot release" into one text. A Gradle user gets told nothing useful.BuildCommandlet:73— the new detection is a package-privatestaticthatReleaseCommandletreaches across into, and it takes anIdeContextparameter although both callers already havethis.context. The issue itself points at the better home: "Ideally we should ask the commandlet manager".BuildCommandlet:75—findBuildCommandletNPEs on anullpath;BuildCommandletguards before calling,ReleaseCommandletdoes not.BuildCommandletTest:142— the yarn-over-npm fix is the user-visible part of this PR but is only covered at helper level; no test asserts thatide buildin the yarn workspace actually runsyarn, and nothing covers the mvn-vs-npm precedence flip.
Minor
ReleaseCommandlet:106— first condition is always true at the only call site.ReleaseCommandlet:102— parameter namedbuildToolbut typedLocalToolCommandlet, whiledoRunhas a different variable also calledbuildTool.BuildCommandlet:55— error message still hardcodes the descriptor list that this PR is de-hardcoding.CHANGELOG.adoc:9— theide buildprecedence fix is user-facing and not mentioned.
PR hygiene
- The branch is BEHIND
mainand needs an update before merge. - The checklist ticks "PR and issue(s) have suitable labels", but this PR carries no labels and no milestone. Per DoD.adoc both should be set before close (the issue itself is labelled fine).
Manual verification
Green CI is not sufficient for this one. ide release drives git commit/git tag/git push and a real deploy build — none of which the mock GitContextImplMock exercises end-to-end. Please do run your own testing instructions (2) and (3) on a real Maven project before merge, and note the result in the PR.
Scope against #2178: the primary ask ("ReleaseCommandlet should ask the available build commandlets if they apply") is met. The Additional context part — discovering build commandlets dynamically via the commandlet manager and expressing the yarn/npm priority without a hardcoded list — is not addressed; BUILD_TOOLS is untouched. That is explicitly framed as "ideally" in the issue, so I am not blocking on it, but please say in the PR whether you consider it out of scope so it can be tracked as a follow-up rather than silently dropped.
955ebf1 to
a99f171
Compare
d58b8fa to
4a6600b
Compare
90c463b to
632af8e
Compare
…dent-of-specific-build-commandlet
This PR fixes #2178
Implemented changes:
Testing instructions
Checklist for this PR
Make sure everything is checked before merging this PR. For further info please also see
our DoD.
mvn clean testlocally all tests pass and build is successful#«issue-id»: «brief summary»(e.g.#921: fixed setup.batand notfeature/921 fixed setup.bat). If no issue ID exists, title only.In Progressand assigned to you or there is no issue (might happen for very small PRs)with
internalpom.xmlfiles or otherwise if runtime dependencies changed, you have updated our LICENSE.asciidoc